/* 
 * File:   Gamecontroller.h
 * Author: Lex, Arno
 *
 * Created on June 20, 2012, 4:14 PM
 */

#ifndef GAMECONTROLLER_H
#define	GAMECONTROLLER_H

#include "SpeakerHandler.h"
#include "IRHandler.h"
#include "LedsHandler.h"
#include "pRTOS.h"
#include "resources.h"
#include "armboard.h"

class Gamecontroller : public RTOS::task, IRListener{
    
public:
    Gamecontroller() : gameTimer( this ), startFlag ( this ), hitFlag ( this ), logFlag ( this ){}
    void startSignalReceived();
    void hitSignalReceived(struct IRSignal);
    void logSignalReceived();
    
private:
     RTOS::timer gameTimer;
     RTOS::flag startFlag, hitFlag, logFlag;
     RTOS::pool < struct IRSignal > IRPool;
     struct IRSignal shooter;
     int hitBy [];
     int playerLives;
     SpeakerHandler spkrHndlr;
     LedsHandler ldsHndlr;
     IRHandler ihrlndr;
     int gameTime, playerID;
     int playerHitAudioDuration, playerHitAudioFrequency, 
             playerHitLedDuration, playerHitLedFrequency,
             playerKillAudioDuration, playerKillAudioFrequency,
             endGameAudioDuration, endGameAudioFrequency;
     void main(void);
     void starting(void);
     void initializing(void);
     void alive(void);
     void dead(void);
     void initializeGame(int gameTime, int players, int playerLives);
     void uploadToPC(int style);
};


#endif	/* GAMECONTROLLER_H */

